/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelRaices.java
 *
 *
 */
package interfaz.FuncionPanels.ecuaciones;

import funcion.ManejadorFuncion;
import interfaz.NuMethodApp;
import interfaz.NuMethodConstants;
import java.awt.Color;
import java.util.ArrayList;
import javax.swing.ImageIcon;
import javax.swing.table.DefaultTableModel;
import metodos.Raices;
//import metodos.ManejadorMetodo;

/**
 *
 * @author The NuMethod Team
 */
public class PanelRaices extends javax.swing.JPanel {

    private String f; //El String que representara la funcion f(X) a utilizar
    private String df; //String que representa la funcion f ' (x)  a ser utilizada
    private String d2f; ///String que representa la funcion f '' (x)  a ser utilizada
    //Variables de la aplicacion
    /**
     * Arreglo de cabeceras de la tabla Raices Multiples
     */
    String[] names = {"N", "Xn", "Yn", "dYn", "Error"};
    private static ImageIcon errorIcon;
    private static ImageIcon okIcon;
    private static ImageIcon halfSuccessIcon;

    /** Creates a new form PanelRaices*/
    public PanelRaices() {
        initComponents();
        initComponents2();


    }

    /**
     * Metodo de utilidad para terminar manualmente la inicializacion de la Interfaz
     */
    private void initComponents2() {
        errorIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/agt_action_fail.png"));
        okIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/agt_action_success.png"));
        halfSuccessIcon = new ImageIcon(getClass().getResource("/recursos/Icons16/admin_icon.png"));


        // Construir una tabla de 2 * 5
        Object[][] data = new Double[2][5];
        DefaultTableModel tm = new DefaultTableModel(data, names);
        TableRaices.setModel(tm);

        //Metodo que establece las funciones desde el panel principal
        updateFunctions();
    }

    /**
     * Este metodo actualiza este panel con las ultimas funciones que han sido
     * <br> colocadas en el sistema
     *
     * <p>
     * Para el caso de Metodo de las Raices Multiples, esta funcion establece las funciones
     * <br> f(x) , f'(x) , f''(x)
     */
    public void updateFunctions() {
        f = NuMethodApp.getF();
        LabelFText.setText(f);

        df = NuMethodApp.getDf();
        LabelFPrimaText.setText(df);

        d2f = NuMethodApp.getD2f();
        LabelF2PrimaText.setText(d2f);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        SPanelProceso = new javax.swing.JScrollPane();
        TableRaices = new org.jdesktop.swingx.JXTable();
        PanelEntrada = new javax.swing.JPanel();
        BotonEjecutar = new javax.swing.JButton();
        LabelInStatus = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        FieldInicial = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        FieldTol = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        FieldIteraciones = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();
        PanelSalida = new javax.swing.JPanel();
        LabelSalida = new javax.swing.JLabel();
        LabelSalida2 = new javax.swing.JLabel();
        PanelEstado = new javax.swing.JPanel();
        LabelF = new javax.swing.JLabel();
        LabelFText = new javax.swing.JLabel();
        LabelFPrima = new javax.swing.JLabel();
        LabelFPrimaText = new javax.swing.JLabel();
        LabelF2Prima = new javax.swing.JLabel();
        LabelF2PrimaText = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();

        setForeground(new java.awt.Color(255, 0, 255));

        SPanelProceso.setBorder(javax.swing.BorderFactory.createTitledBorder("Proceso"));
        SPanelProceso.setToolTipText("Proceso de salida");

        TableRaices.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4"
            }
        ));
        SPanelProceso.setViewportView(TableRaices);

        PanelEntrada.setBorder(javax.swing.BorderFactory.createTitledBorder("Entrada"));

        BotonEjecutar.setText("Ejecutar");
        BotonEjecutar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BotonEjecutarActionPerformed(evt);
            }
        });

        jPanel2.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        FieldInicial.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                FieldInicialActionPerformed(evt);
            }
        });

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/kodo.png"))); // NOI18N
        jLabel2.setText("Valor Inicial");
        jLabel2.setToolTipText("Valor de inicio del metodo");

        jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/agt_update_critical.png"))); // NOI18N
        jLabel3.setText("Tolerancia");
        jLabel3.setToolTipText("Valor maximo de error que se espera devuelva el metodo");

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/Icons16/idea.png"))); // NOI18N
        jLabel4.setText("# de iteraciones");
        jLabel4.setToolTipText("Canridad maxima de operaciones que puede realizar el metodo");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(FieldIteraciones, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FieldTol, javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(FieldInicial, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel4))
                .addContainerGap(71, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldInicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldTol, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(FieldIteraciones, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout PanelEntradaLayout = new javax.swing.GroupLayout(PanelEntrada);
        PanelEntrada.setLayout(PanelEntradaLayout);
        PanelEntradaLayout.setHorizontalGroup(
            PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEntradaLayout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(107, 107, 107)
                .addComponent(LabelInStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 327, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, PanelEntradaLayout.createSequentialGroup()
                .addContainerGap(544, Short.MAX_VALUE)
                .addComponent(BotonEjecutar)
                .addGap(139, 139, 139))
        );
        PanelEntradaLayout.setVerticalGroup(
            PanelEntradaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEntradaLayout.createSequentialGroup()
                .addComponent(LabelInStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 86, Short.MAX_VALUE)
                .addComponent(BotonEjecutar))
            .addGroup(PanelEntradaLayout.createSequentialGroup()
                .addGap(11, 11, 11)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11))
        );

        jLabel1.setText("Metodo de las Raices Multiples");

        PanelSalida.setBorder(javax.swing.BorderFactory.createTitledBorder("Salida"));

        javax.swing.GroupLayout PanelSalidaLayout = new javax.swing.GroupLayout(PanelSalida);
        PanelSalida.setLayout(PanelSalidaLayout);
        PanelSalidaLayout.setHorizontalGroup(
            PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelSalidaLayout.createSequentialGroup()
                .addGroup(PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(LabelSalida)
                    .addGroup(PanelSalidaLayout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(LabelSalida2)))
                .addContainerGap(594, Short.MAX_VALUE))
        );
        PanelSalidaLayout.setVerticalGroup(
            PanelSalidaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelSalidaLayout.createSequentialGroup()
                .addComponent(LabelSalida)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 32, Short.MAX_VALUE)
                .addComponent(LabelSalida2)
                .addContainerGap())
        );

        PanelEstado.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        LabelF.setText("f(x) = ");

        LabelFPrima.setText("f '(x) =");

        LabelF2Prima.setText("f '' (x) = ");

        javax.swing.GroupLayout PanelEstadoLayout = new javax.swing.GroupLayout(PanelEstado);
        PanelEstado.setLayout(PanelEstadoLayout);
        PanelEstadoLayout.setHorizontalGroup(
            PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEstadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(PanelEstadoLayout.createSequentialGroup()
                        .addComponent(LabelF)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LabelFText)
                        .addGap(237, 237, 237)
                        .addComponent(LabelF2Prima)
                        .addGap(6, 6, 6)
                        .addComponent(LabelF2PrimaText, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE))
                    .addGroup(PanelEstadoLayout.createSequentialGroup()
                        .addComponent(LabelFPrima)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LabelFPrimaText)))
                .addContainerGap())
        );
        PanelEstadoLayout.setVerticalGroup(
            PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PanelEstadoLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelF)
                    .addComponent(LabelFText)
                    .addComponent(LabelF2Prima)
                    .addComponent(LabelF2PrimaText, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(PanelEstadoLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(LabelFPrima)
                    .addComponent(LabelFPrimaText))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/recursos/help.png"))); // NOI18N
        jButton1.setToolTipText("Ayuda");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(PanelSalida, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(SPanelProceso, javax.swing.GroupLayout.DEFAULT_SIZE, 620, Short.MAX_VALUE))
                    .addComponent(PanelEntrada, javax.swing.GroupLayout.Alignment.LEADING, 0, 630, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel1)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 37, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(10, 10, 10)
                                .addComponent(PanelEstado, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(PanelEstado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(PanelEntrada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(SPanelProceso, javax.swing.GroupLayout.DEFAULT_SIZE, 239, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(PanelSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
    }// </editor-fold>//GEN-END:initComponents

    /**
     * Metodo que reconstruye la tabla luego de cada ejecucion.
     * <p>Este metodo actualiza los datos de la tabla para no mostrar datos incorrectos
     * @param Iters
     * @param Xn
     * @param Yn
     * @param dYn
     * @param Errors
     */
    private void reBuildRaicesTableModel(ArrayList<Integer> Iters,
            ArrayList<Double> Xn,
            ArrayList<Double> Yn,
            ArrayList<Double> dYn,
            ArrayList<Double> Errors) {
        int n = Xn.size();
        Double[][] data = new Double[n][5];
        for (int i = 0; i < n; i++) {
            data[i][0] = Iters.get(i).doubleValue();
            data[i][1] = Xn.get(i);
            data[i][2] = Yn.get(i);
            data[i][3] = dYn.get(i);
            data[i][4] = Errors.get(i);
        }

        DefaultTableModel tm = new DefaultTableModel(data, names);
        TableRaices.setModel(tm);
        tm.fireTableDataChanged();
    }

    private void BotonEjecutarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BotonEjecutarActionPerformed
        int Iter = 0;
        double x0 = 0;
        double tol = 0;

        int resultStatus = 0;
        //Validaciones de campos de texto
        if (!(FieldInicial.getText().equals("")) || FieldInicial.getText() != null) { //Verificar que no haya valores nulos en el campo Valor Inicial
            if (!(FieldIteraciones.getText().equals("")) || FieldIteraciones.getText() != null) { //Verificar que no haya valores nulos en el campo Iteraciones
                if (!(FieldTol.getText().equals("")) || FieldTol.getText() != null) { //Verificar que no haya valores nulos en el campo Tolerancia
                    // <editor-fold defaultstate="collapsed" desc="Validar los datos desde la interfaz">
                    try {
                        x0 = Double.parseDouble(FieldInicial.getText()); //Tratar de obtener un numero del campo valor inicial
                    } catch (NumberFormatException e) {
                        LabelInStatus.setText("Error obteniendo el numero desde el campo Valor Inicial");
                        return;
                    }
                    ///--------
                    try {
                        Iter = Integer.parseInt(FieldIteraciones.getText()); //Tratar de obtener un numero del campo Iteraciones
                    } catch (NumberFormatException e) {
                        LabelInStatus.setText("Error obteniendo el valor desde el campo Iteraciones");
                        return;
                    }
                    ///--------
                    try {
                        tol = Double.parseDouble(FieldTol.getText()); //Tratar de obtener la tolerancia desde el campo tolerancia
                    } catch (NumberFormatException e) {
                        LabelInStatus.setText("Error obteniendo el campo tolerancia");
                        return;
                    }
                    ///--------// </editor-fold>
                    // <editor-fold defaultstate="collapsed" desc="Ejecutar el Metodo">
//Obtenidos y parseados todos los valores, a trabajar

                    //Agregar la funcion f al parser
                    ManejadorFuncion.getInstance().addFuncion("f", "x", f);

                    //Agregar la funcion df (f' ) al parser
                    ManejadorFuncion.getInstance().addFuncion("df", "x", df);

                    //Agregar la funcion d2f al parser
                    ManejadorFuncion.getInstance().addFuncion("ddf", "x", d2f);


                    Raices.solucionar(x0, tol, Iter);
                    reBuildRaicesTableModel(
                            Raices.Iters,
                            Raices.Xn,
                            Raices.Yn,
                            Raices.DYn,
                            Raices.Errors);// </editor-fold>
                    // <editor-fold defaultstate="collapsed" desc="Mostrar el resultado">
                    //Se termino el metodo, debemos verificar los resultados e imprimir.
                    resultStatus = Raices.getLatestStatus();
                    Double temp = Raices.Xn.get(Raices.Xn.size() - 1);
                    switch (resultStatus) {
                        case (NuMethodConstants.IS_ROOT): {
                            LabelSalida.setText("Se logro un resultado sin errores");
                            LabelSalida.setForeground(Color.GREEN);
                            LabelSalida.setIcon(okIcon);
                            LabelSalida2.setText("El resultado es: " + temp);

                            break;
                        }
                        case (NuMethodConstants.IS_ROOT_PLUS_ERROR): {
                            LabelSalida.setText("Se logro un resultado con error");
                            LabelSalida.setForeground(Color.ORANGE);
                            LabelSalida.setIcon(halfSuccessIcon);
                            LabelSalida2.setText(
                                    "El resultado es: " + temp
                                    + " + un error de: "
                                    + Raices.Errors.get(Raices.Errors.size() - 1));
                            break;
                        }
                        case (NuMethodConstants.IS_ERROR): {
                            LabelSalida.setText("No fue posible encontrar un resultado con las iteraciones pedidas. devolviendo los ultimos status");
                            LabelSalida.setForeground(Color.red);
                            LabelSalida.setIcon(errorIcon);
                            LabelSalida2.setText(
                                    "Ultimo valor obtenido: " + temp
                                    + " + un error de: "
                                    + Raices.Errors.get(Raices.Errors.size() - 1)
                                    + " con un total de: " + Raices.Iters.get(Raices.Iters.size() - 2) + " Iteraciones");
                            break;
                        }
                        case (NuMethodConstants.IS_DIVISION_BY_ZERO): {
                            LabelSalida.setText("El Metodo encontro un error durante su ejecucion");
                            LabelSalida.setForeground(Color.red);
                            LabelSalida.setIcon(errorIcon);
                            LabelSalida2.setText("Una division por zero aparecio durante la ejecucion del metodo en la iteracion #"
                                    + Raices.DYn.get(Raices.DYn.size() - 1));
                            break;
                        }
                    }// </editor-fold>
                    //Se obtuvieron los datos, ahora podemos vaciar los arreglos temporales
                    Raices.flushTempArrays();

                }//Fin tercer campo
                else {
                    LabelInStatus.setText("Por favor determinar una tolerancia");
                }
            }//Fin Segundo campo
            else {
                LabelInStatus.setText("Por favor colocar un minimo de iteraciones");
            }
        }//Fin Primer campo
        else {
            LabelInStatus.setText("Por favor colocar un valor inicial");
        }

    }//GEN-LAST:event_BotonEjecutarActionPerformed

    private void FieldInicialActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FieldInicialActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_FieldInicialActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        NuMethodApp.helpLauncher("RaicesMultiples.html");
    }//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BotonEjecutar;
    private javax.swing.JTextField FieldInicial;
    private javax.swing.JTextField FieldIteraciones;
    private javax.swing.JTextField FieldTol;
    private javax.swing.JLabel LabelF;
    private javax.swing.JLabel LabelF2Prima;
    private javax.swing.JLabel LabelF2PrimaText;
    private javax.swing.JLabel LabelFPrima;
    private javax.swing.JLabel LabelFPrimaText;
    private javax.swing.JLabel LabelFText;
    private javax.swing.JLabel LabelInStatus;
    private javax.swing.JLabel LabelSalida;
    private javax.swing.JLabel LabelSalida2;
    private javax.swing.JPanel PanelEntrada;
    private javax.swing.JPanel PanelEstado;
    private javax.swing.JPanel PanelSalida;
    private javax.swing.JScrollPane SPanelProceso;
    public org.jdesktop.swingx.JXTable TableRaices;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JPanel jPanel2;
    // End of variables declaration//GEN-END:variables
}
